import torch
from torch.utils.tensorboard import SummaryWriter
import numpy as np
from PIL import Image

writer = SummaryWriter("logs") #存储到的文件名
image_path = "data/OIP-C.jpg"  #相对路径
img_PIL = Image.open(image_path)
img_array = np.array(img_PIL)
print(type(img_array))
print(img_array.shape)
writer.add_image("test",img_array,2, dataformats="HWC")

for i in range(100):
    writer.add_scalar("y = 2x", 10*i, i) # add_scalar("tag",Y,X)
writer.close()



